import api from '@/utils/request'

export default class userApi {
    static login = (data: any) => api({
        url: '/admin/login/', // 请求地址
        method: 'post',
        data
    })

    static logout = () => api({
        url: '/admin/logout/', // 请求地址
        method: 'post'
    })

    static userinfo = () => api(
        {
            url: '/admin/userinfo/',
            method: 'get',
        }
    )

    /**
     * @description 获取用户列表
     * @param data
     */
    static fetchList = (data: any) => api({
        url: '/admin/list/', // 请求地址
        method: 'get',
        params: data
    })

    /**
     * @description 用户注册
     * @param data
     */
    static sign = (data: any) => api({
        url: '/user/sign/', // 请求地址
        method: 'post',
        data
    })

    /**
     * @description 用户登录
     * @param data
     */
    static userLogin = (data: any) => api({
        url: '/user/login/', // 请求地址
        method: 'post',
        data
    })

    /**
     * @description 创建前台
     * @param data
     */
    static createFrontUser = (data: any) => api({
        url: '/admin/create-front-user/', // 请求地址
        method: 'post',
        data
    })

    /**
     * @description 管理员修改前台用户
     * @param data
     */
    static editFrontUser = (data: any) => api({
        url: '/admin/edit-front-user/', // 请求地址
        method: 'post',
        data
    })

    static searchUserinfo = (data: any) => api({
        url: '/userinfo/search/', // 请求地址
        method: 'get',
        params: data
    })

    static fetchListJoinUser = (data: any) => api({
        url: '/userinfo/list-join-user/', // 请求地址
        method: 'get',
        params: data
    })

    static fetchListJoinUserOnlyUser = (data: any) => api({
        url: '/userinfo/list-join-user-only-user/', // 请求地址
        method: 'get',
        params: data
    })


    static changePassword = (data: any) => api({
        url: '/user/change-password/', // 请求地址
        method: 'post',
        data
    })

    static createUserinfo = (data: any) => api({
        url: '/admin/create-userinfo/', // 请求地址
        method: 'post',
        data
    })

    static editUserinfo = (data: any) => api({
        url: '/admin/edit-userinfo/', // 请求地址
        method: 'post',
        data
    })

    static createReader = (data: any) => api({
        url: '/admin/create-reader/', // 请求地址
        method: 'post',
        data
    })

    static setStatus = (data: any) => api({
        url: '/userinfo/set-status/', // 请求地址
        method: 'post',
        data
    })
}


